package com.hundsun.s3.platform.backstage.common.util;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * com.hundsun.s3.platform.backstage.common.util
 *
 * @Description:
 * @Author: yangjun23614
 * @Date: Created in 9:26 2018/3/12
 * V1.0 9:26 2018/3/12
 */
public class TransformatUtil {
    /**
     * @Description: 转换为四位string,参数不能超过四位
     * @param:
     * @return:
     * @Author: yangjun23614
     * @Date: 9:27 2018/3/12
     * V1.0
     */
    public static String integerToString(int param) {
        char[] deptString = {'0','0','0','0'};
        int i = 3;
        while (param!=0){
            int remainder = param % 10;
            param /= 10;
            deptString[i] = Integer.toString(remainder).charAt(0);
            i--;
        }
        return String.valueOf(deptString);
    }

    /**
     * @Description: 时间戳到Long类型转换
     * @param: 
     * @return:
     * @Author: yangjun23614
     * @Date: 10:00 2018/3/16
     * V1.0 
     */
    public static Long timestampToLong(String timestamp) {
        String formatType = "yyyyMMddHHmmss";
        Date dateOld = new Date(Long.parseLong(timestamp));
        String dateLong = new SimpleDateFormat(formatType).format(dateOld);
        return Long.parseLong(dateLong);
    }

}
